The content of the invention
In view of this, the present invention solves the technical problem of provide a kind of side for setting the anti-deleted marker position of file
Method, method, mobile terminal and the storage device for preventing from deleting file by mistake, it is possible to increase judge whether file destination is protected
The efficiency of file.
In order to solve the above technical problems, one aspect of the present invention is:A kind of setting anti-deletion of file is provided
The method of flag bit, this method include:
Obtain the directory information of file;According to the directory information of file, the index node information of file is obtained;In file
Increase anti-deleted marker position in index node information and by anti-deleted marker position position.
In order to solve the above technical problems, another technical scheme that the present invention uses is:There is provided one kind prevents from deleting text by mistake
Part method, this method include:
According to the path of file destination, judge whether the anti-deleted marker position of each catalogue file of file destination is set to step by step
Position;
If the anti-deleted marker position of current directory file is set, the mistake for needing to identify that identity authority could delete is returned
Code by mistake;If the anti-deleted marker position of current directory file is not set, judge whether current directory file is target text
The parent directory file of part,
If current directory file is the parent directory file of file destination, whether the anti-deleted marker position of detection file destination
It is set, if the anti-deleted marker position of file destination is set, returns to the wrong generation for needing to identify that identity authority could delete
Code.
In order to solve the above technical problems, another technical scheme that the present invention uses is:A kind of mobile terminal is provided, the shifting
Dynamic terminal is able to carry out program to realize following methods:
According to the path of file destination, judge whether the anti-deleted marker position of each catalogue file of file destination is set to step by step
Position;
If the anti-deleted marker position of current directory file is set, the mistake for needing to identify that identity authority could delete is returned
Code by mistake;If the anti-deleted marker position of current directory file is not set, judge whether current directory file is target text
The parent directory file of part,
If current directory file is the parent directory file of file destination, whether the anti-deleted marker position of detection file destination
It is set, if the anti-deleted marker position of file destination is set, returns to the wrong generation for needing to identify that identity authority could delete
Code.
In order to solve the above technical problems, another technical scheme that the present invention uses is:A kind of storage device is provided, this is deposited
Storage device is had program stored therein data, and the routine data can be performed to realize following methods:
According to the path of file destination, judge whether the anti-deleted marker position of each catalogue file of file destination is set to step by step
Position;
If the anti-deleted marker position of current directory file is set, the mistake for needing to identify that identity authority could delete is returned
Code by mistake;If the anti-deleted marker position of current directory file is not set, judge whether current directory file is target text
The parent directory file of part,
If current directory file is the parent directory file of file destination, whether the anti-deleted marker position of detection file destination
It is set, if the anti-deleted marker position of file destination is set, returns to the wrong generation for needing to identify that identity authority could delete
Code.
The beneficial effects of the invention are as follows:Path compared to prior art by the agent-protected file according to record, judge
Delete whether file is agent-protected file, so as to protect agent-protected file not deleted by mistake, and the present invention is by file
Increase anti-deleted marker position in index node information, if the anti-deleted marker position of file destination is set, delete target file
When can return and need to identify that identity authority could delete, and then protect file destination not deleted by mistake, it is possible to increase to judge target
File whether be agent-protected file efficiency.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete
Site preparation describes.
The method for the anti-deleted marker position of setting file that the present embodiment is illustrated and prevent by mistake delete file method can
So that based on IOS systems, android system and Saipan system etc., only anti-deleted marker position need to be added in relevant position, it is possible to
Realize the method for the anti-deleted marker position of setting file that the present embodiment is illustrated and prevent the method for deleting file by mistake, herein not
Limit.In following examples, it is described in detail by taking android system as an example.
Referring to Fig. 1, Fig. 1 is the structural representation of the embodiment of file content storage mode one of the present invention.
As skilled in the art to understand, the user file of the mobile terminal based on android system is typically established at
In storage medium, such as SDCARD etc., file includes data content and attribute information, and data content is file institute stored record
User profile, such as photo, audio and video etc., attribute information is the information aggregate of file itself, data content and category
Property information is stored in different blocks, and attribute information is deposited in iNode (index node), and data content then deposits in Data
In block (data block), there are some Global Informations to deposit in Super block (superblock) certainly.Super block are recorded
The Global Information of whole file system, including the total amount of iNode and block, usage amount, the form etc. of surplus and file system;
The data content of Data block log files, one or more blocks are taken according to data content size.INode log files
Data block numbers where attribute information and data content, a file take an iNode, and attribute information mainly wraps
Include:File type (generic-document, catalogue file, Socket files, symbolic link file etc.);File memory module (it is readable,
It is writeable etc.);The owner of file and group;The size of file;Timestamp (is established or the time of state change, the last
Read access time and time for changing recently etc.);Define the mark of file attributes;The sensing of file real content, that is, deposit number
According to the Data block numbers of content.
Each catalogue file stores the directory entry of each file under its catalogue, directory entry store filename and with filename pair
Where the iNode number answered, that is, the index node iNode of file.The access of file is to be looked for step by step by file path
To the directory entry of this document, corresponding iNode number are found in the directory entry of this document, so as to find the index of file
Node i Node information, obtain the authority information stored in index node iNode, flag bit and the data block for pointing to data block
Number index information, wherein, the data block number index information of data block is pointed to, as deposits the Data block of file data content
Number.
When deleting file, it is file (namely its parent directory) where finding file by file path that it, which is operated, right
The corresponding directory entry being stored in the directory entry table of parent directory does deletion record operation.Therefore need to find corresponding to file
INode number simultaneously read iNode information.If increasing an anti-deleted marker position in file mark information, examined before deletion
The anti-deleted marker position looked into iNode information, it is possible to realize the anti-deletion of file.
Its parent directory is first found when deleting file as described above, its positioning action is by file path one-level one-level
The directory entry for finding this document, this operation is realized by function, is to return to the iNode nodes of parent directory,
Being used as parameter by the incoming mark for finding file destination parent directory file, (operation such as opening and execution is same to distinguish other operations
Sample needs to call a function to find the inode of file).(open, hold to distinguish other operations by an incoming mark newly added
The operation such as row), so during the searching of one-level one-level, it is intended to the iNode nodes of deleted file parent directory are found, if to every
Anti- deleted marker position is all checked corresponding to first class catalogue file, it is found that this flag bit is set and be returned to upper strata authority not
Enough need to identify the error code of identity authority, it is possible to realize to All Files (including the text under subdirectory under this catalogue
Part) anti-deletion control.
Referring to Fig. 2, Fig. 2 is the schematic flow sheet that the present invention sets the anti-embodiment of deleted marker position method one of file.Need
To illustrate that in the present embodiment, the method for the anti-deleted marker position of file is set to include but is not limited to following steps:S201:Obtain
Take the directory information of file;
In the present embodiment, the parent directory file of file destination is found by call function, to obtain the mesh of file destination
Information is recorded, the parent directory file of file destination is stored in the immediate superior file of file destination, finds father's mesh of file destination
Mark of the function with searching file destination parent directory file that record file is called, operation is found to distinguish other, such as
Open file operation, file operation etc. is performed, open file operation, the operations such as file operation is performed and is all operated with searching, because
This present embodiment further improves the present embodiment and finds mesh by the function with the mark for finding file destination parent directory file
Mark the efficiency of the parent directory file of file.
S202:According to the directory information of file, the index node information of file is obtained;
In the present embodiment, the directory information of file destination is stored with the parent directory file of file destination, passes through target
The directory information of file finds the iNode number of file destination, then the rope of file destination is read by iNode number
Draw nodal information.
S203:Increase anti-deleted marker position in the index node information of file and by anti-deleted marker position position;
In the present embodiment, anti-deleted marker is added in the zone bit information in the index node information of file destination
Position, anti-deleted marker position initial assignment is " 0 ", and representing file destination need not identify that identity authority can delete, by anti-deletion
Flag bit set, that is, anti-deleted marker position assignment is revised as " 1 ", file destination needs to identify that identity authority can just delete
Remove.
Above as can be seen that the present invention in the index node of file destination by setting anti-deleted marker position, to target
File is protected by, and is prevented because maloperation causes file destination to be deleted by mistake, without recording the path of all file destinations, from
And improve judge file destination whether be agent-protected file efficiency.
Referring to Fig. 3, Fig. 3 is the schematic flow sheet that the present invention sets the anti-another embodiment of deleted marker position method of file.
It should be noted that in the present embodiment, the method for the anti-deleted marker position of file is set to include but is not limited to following steps:
S301:Initiate the anti-deleted marker position of setting file destination;
In the present embodiment, selection needs the file destination being protected by and anti-deleted marker position is set to it, target text
Part can be photo, audio, video and document etc., prevent because artificial maloperation deleted file can be this place
The file destination of elaboration, is not limited herein.
Alternatively, selected target file and anti-deleted marker position can be set to it in the operating system of mobile terminal, or
Person is that the file destination browsed is selected in browsing objective file processes and anti-deleted marker position etc. is set to it, herein not
Limit.
S302:By file destination path, the directory information of file destination is obtained;
In the present embodiment, the parent directory file of file destination is found by call function, to obtain the mesh of file destination
Information is recorded, the parent directory file of file destination is stored in the immediate superior file of file destination, finds father's mesh of file destination
Mark of the function with searching file destination parent directory file that record file is called, operation is found to distinguish other, such as
Open file operation, file operation etc. is performed, open file operation, the operations such as file operation is performed and is all operated with searching, because
This present embodiment further improves the present embodiment and finds mesh by the function with the mark for finding file destination parent directory file
Mark the efficiency of the parent directory file of file.
S303:Determine whether the modification authority of file destination;
In the present embodiment, the modification authority of file destination is determined whether:If there is the modification authority of file destination, hold
Row step S304;If the modification authority without file destination, step S307 is performed.
Alternatively, file destination can be built-in system file of mobile terminal etc., and file destination now is mobile whole
File necessary to end system, does not allow peripheral operation to modify it, therefore does not possess the power of amendment of such file destination
Limit.
S304:According to the directory information of file destination, the index node information of file destination is obtained;
In the present embodiment, the directory information of file destination is stored with the parent directory file of file destination, passes through target
The directory information of file finds the iNode number of file destination, then the rope of file destination is read by iNode number
Draw nodal information.
S305:Increase anti-deleted marker position in the index node information of file destination and by anti-deleted marker position position;
In the present embodiment, anti-deleted marker is added in the zone bit information in the index node information of file destination
Position, anti-deleted marker position initial assignment is " 0 ", and representing file destination need not identify that identity authority can delete, by anti-deletion
Flag bit set, that is, anti-deleted marker position assignment is revised as " 1 ", file destination needs to identify that identity authority can just delete
Remove.
Alternatively, it is corresponding with by anti-deleted marker position position, anti-deleted marker position can also be reset, by anti-deleted marker position
The value assigned is changed to 0 by 1, and then file destination is identified that identity authority can just delete.
Alternatively, it can be the identification identity authority of generation one interface to identify identity authority, defeated at identification identity authority interface
Enter identity authority information, if identity authority information matches preset identity authority information, identification identity authority passes through on the contrary then reflect
Identity authority is determined not by the way that certainly, as skilled in the art to understand, it can also be inside mobile terminal to identify identity authority
Captured identity authority information, matched with default identity authority information, do not limited herein.
Alternatively, identity authority information and default identity authority information can be password, fingerprint or vocal print etc., represent
The identity information of the identity information of identity uniqueness or intelligent wearable device record record identity uniqueness, passes through
Information transfer between intelligent wearable device and mobile terminal, matched with default identity authority information, do not limited herein.
S306:Return is set successfully;
In the present embodiment, after the anti-deleted marker position of file destination is successfully set, when delete target file, will sentence
Whether the anti-deleted marker position of disconnected file destination is set:If being set, return needs to identify that identity authority could delete simultaneously
Generation identification identity authority interface;If not being set, delete target file.
S307:Return to lack of competence modification file destination;
In the present embodiment, to file destination without modification authority, it may be the necessary text of internal system institute to illustrate file destination
Part, delete target file, system may be caused not operate, the type file is that can not change text when mobile terminal dispatches from the factory
Part, also the flag bit of such file destination can not just be modified.
Above as can be seen that the present invention in the index node of file destination by setting anti-deleted marker position, to target
File is protected by, and is prevented because maloperation causes file destination to be deleted by mistake, without recording the path of all file destinations, from
And improve judge file destination whether be agent-protected file efficiency.
Prevent from deleting the schematic flow sheet of the embodiment of document method one by mistake referring to Fig. 4, Fig. 4 is the present invention.Need to illustrate
Be in the present embodiment, the anti-deleted marker position method of setting file illustrated based on above-described embodiment prevent by mistake delete text
Part method includes but is not limited to following steps:
S401:Initiate delete target file;
In the present embodiment, file destination can be photo, audio, video and document etc., prevent from grasping by mistake due to artificial
It can be file destination set forth herein to make deleted file, do not limited herein.
Alternatively, selected target file and deletion action can be initiated to it in the operating system of mobile terminal, either
The file destination browsed is selected in browsing objective file processes and initiates it deletion action etc., is not limited herein.
S402:According to file destination path, each catalogue file of file destination is found step by step;
In the present embodiment, each catalogue file of file destination is found step by step, it is intended to the parent directory file of file destination is found,
The parent directory file of file destination is found by call function, to obtain the directory information of file destination, father's mesh of file destination
Record file is stored in the immediate superior file of file destination.The function that the parent directory file of searching file destination is called carries
The mark of file destination parent directory file is found, operation, such as open file operation is found to distinguish other, performs file behaviour
Work etc., open file operation, the operations such as file operation is performed all with searching operation, therefore the present embodiment passes through with searching mesh
The function of the mark of file parent directory file is marked, further improves the effect that the present embodiment finds the parent directory file of file destination
Rate.
S403:Judge whether the anti-deleted marker position of current directory file is set;
In the present embodiment, if the anti-deleted marker position of current directory file is not set, step S404 is performed, if
The anti-deleted marker position of current directory file is set, then performs step S406.
S404:Judge current directory file whether be file destination parent directory file;
In the present embodiment, if current directory file is the parent directory file of file destination, it is possible in file destination
The inode number of file destination is found in parent directory file, so as to find the index node information of file destination, and then is found
The anti-deleted marker position of file destination, then step S405 is performed, if the parent directory file of the non-targeted file of current directory file,
Perform step S402.
S405:Judge whether the anti-deleted marker position of file destination is set;
In the present embodiment, if the anti-deleted marker position of file destination is set, illustrate that user is provided with to file destination
Anti- deleted marker position is protected by, and is prevented because artificial maloperation causes file destination to be deleted by mistake, then performs step S406, if
The anti-deleted marker position of file destination is not set, then performs step S408.
S406:Return to the error code for needing to identify that identity authority could delete;
In the present embodiment, this step S406 is triggered by step S403, if identification identity authority is by performing step
S404, if current directory file is not the parent directory file of the file destination, reset the anti-deleted marker of current directory file
Position, and by the anti-deleted marker position position of current directory file after preset time;Afterwards, step S402 is performed;If current mesh
Record file is the parent directory file of the file destination, then performs step S405.
This step S406 is triggered by step S405, if identification identity authority is by performing step S408, if identification identity
Authority fails, then performs step S409.
Alternatively, it can be the identification identity authority of generation one interface to identify identity authority, defeated at identification identity authority interface
Enter identity authority information, if identity authority information matches preset identity authority information, identification identity authority passes through on the contrary then reflect
Identity authority is determined not by the way that certainly, as skilled in the art to understand, it can also be inside mobile terminal to identify identity authority
Captured identity authority information, matched with default identity authority information, do not limited herein.
Alternatively, identity authority information and default identity authority information can be password, fingerprint or vocal print etc., represent
The identity information of the identity information of identity uniqueness or intelligent wearable device record record identity uniqueness, passes through
Information transfer between intelligent wearable device and mobile terminal, matched with default identity authority information, do not limited herein.
S407:It is interim to remove the anti-deleted marker position of catalogue file, and recover this catalogue file again after preset time
Anti- deleted marker position;
Step S407 continues executing with step S402 after performing.In the present embodiment, if the upper file of file destination
Anti- deleted marker position is set, and the function called would not continue to find the parent directory text of file destination toward subordinate's catalogue file
Part, it is therefore desirable to the anti-deleted marker position of current directory file is deleted in preset time.
Alternatively, preset time can be 5s, and preset time can be according to the processing speed and use of mobile terminal system
Family needs to be set, and does not limit herein.
S408:Delete target file;
In the present embodiment, by way of above-described embodiment illustrates to prevent deletion file by mistake, file destination is process
Identify that identity authority is just deleted, can avoid because artificial maloperation causes file destination to be deleted by mistake.
S409:Delete target file fails;
In the present embodiment, identify identity authority not by initiating the operation failure of delete target file, can be institute
Input identity authority information and default identity authority information to mismatch, or be due to maloperation, find maloperation during deletion,
Identification identity authority is set to fail consciously, so as to avoid because artificial maloperation causes file destination to be deleted by mistake.
In summary, the present invention to file destination by by file destination anti-deleted marker position position, being protected by, working as hair
When playing delete target file operation, judge whether the anti-deleted marker position of file destination is set, so as to prevent due to maloperation
Cause file destination to be deleted by mistake, without recording the path of all file destinations, and then improve judge file destination whether be by
Protect the efficiency of file.
Referring to Fig. 5, Fig. 5 is the structural representation of the embodiment of mobile terminal one of the present invention.
In the present embodiment, mobile terminal 500 is able to carry out program to realize that what above-described embodiment illustrated prevents from deleting by mistake
Except the method for file, will not be repeated here.
Referring to Fig. 6, Fig. 6 is the structural representation of the embodiment of inventive memory device one.
In the present embodiment, storage device 600 is had program stored therein data 601, and routine data 601 can be performed to realize
What above-described embodiment was illustrated prevents from missing the method for deleting file, just repeats no more herein.
In several embodiments provided by the present invention, it should be understood that disclosed system, apparatus and method can
To realize by another way.For example, device embodiments described above are only schematical, for example, the mould
The division of block or unit, only a kind of division of logic function, can there is other dividing mode when actually realizing, such as multiple
Unit or component can combine or be desirably integrated into another system, or some features can be ignored, or not perform.It is another
Point, shown or discussed mutual coupling or direct-coupling or communication connection can be by some interfaces, device or
The INDIRECT COUPLING of unit or communication connection, can be electrical, mechanical or other forms.
The unit illustrated as separating component can be or may not be physically separate, show as unit
The part shown can be or may not be physical location, you can with positioned at a place, or can also be distributed to multiple
On NE.Some or all of unit therein can be selected to realize the mesh of present embodiment according to the actual needs
's.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, also may be used
To be that unit is individually physically present, can also two or more units it is integrated in a unit.It is above-mentioned integrated
Unit can both be realized in the form of hardware, can also be realized in the form of SFU software functional unit.
If the integrated unit is realized in the form of SFU software functional unit and is used as independent production marketing or use
When, it can be stored in a computer read/write memory medium.Based on such understanding, technical scheme is substantially
The part to be contributed in other words to prior art or all or part of the technical scheme can be in the form of software products
Embody, the computer software product is stored in a storage medium, including some instructions are causing a computer
It is each that equipment (can be personal computer, server, or network equipment etc.) or processor (processor) perform the present invention
The all or part of step of embodiment methods described.And foregoing storage medium includes:USB flash disk, mobile hard disk, read-only storage
(ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disc or CD
Etc. it is various can be with the medium of store program codes.
Embodiments of the present invention are the foregoing is only, are not intended to limit the scope of the invention, it is every to utilize this
The equivalent structure or equivalent flow conversion that description of the invention and accompanying drawing content are made, or directly or indirectly it is used in other correlations
Technical field, it is included within the scope of the present invention.