Changes by: antona
Update of /cvsroot/linux-ntfs/linux-ntfs/include
In directory usw-pr-cvs1:/tmp/cvs-serv8700/include
Modified Files:
attrib.h
Log Message:
Added in the current state of attribute handling to libntfs.
Now just missing the make files to make a first public release of ntfsfix!
Index: attrib.h
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/include/attrib.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** attrib.h 2001/01/28 05:49:57 1.4
--- attrib.h 2001/01/30 00:13:11 1.5
***************
*** 254,258 ****
* present only if the file has been accessed since the upgrade. Recognize
* the difference by comparing the length of the resident attribute value. If
! * it is 48, then the following fields are missing. If it is 72 then the fields
* are present. Maybe just check like this:
* if (resident.ValueLength < sizeof(STANDARD_INFORMATION)) {
--- 254,258 ----
* present only if the file has been accessed since the upgrade. Recognize
* the difference by comparing the length of the resident attribute value. If
! * * it is 48, then the following fields are missing. If it is 72 then the fields
* are present. Maybe just check like this:
* if (resident.ValueLength < sizeof(STANDARD_INFORMATION)) {
***************
*** 781,838 ****
/* FIXME: Should this be a linked list so it is easier/quicker to edit? */
! /*
* Allocate a run_list array and decompress the run-list of the non-resident
! * attribute attr into the run_list array.
* Return a pointer to the run_list array or NULL on error.
* Notes: caller has to free the run_list array when finished.
*/
! run_list decompress_run_list(NONRESIDENT_ATTRIBUTE_RECORD_HEADER *attr);
! /*
! * Determine the logical cluster number given the virtual cluster number and
! * the run list describing the mapping between the LCNs and VCNs.
* Return -ERRNO on error (ERRNO being the error number) and notably -NOENT
* if vcn is outside the boundaries covered by the run list.
*/
! __s64 vcn_to_lcn(run_list rl, __s64 vcn);
! /*
! * Set the volume flags in the Mft record b to flags.
* Return 1 on success or 0 on error.
*/
! int set_ntfs_volume_flags(MFT_RECORD_HEADER *b, __u16 flags);
! /*
! * Get the location of the desired attribute of type t and name n (n can be
! * NULL for unnamed attributes; note that n is a Unicode string). Return a
* pointer to the attribute or NULL if the attribute is not present or an
* error situation exists.
! */
! ATTRIBUTE_RECORD_HEADER *find_attribute(MFT_RECORD_HEADER *b, ATTRIBUTE_TYPE t,
! wchar_t *n);
#include "volume.h"
! /*
! * Return the byte size of the attribute value (as it would be after eventual
! * decompression and filling in of holes if sparse.
* If we return 0, check errno. If errno is 0 the actual length was 0,
* otherwise errno describes the error.
*/
! __u64 get_attribute_value_length(ATTRIBUTE_RECORD_HEADER *a);
! /*
! * Make a copy of the attribute value of the attribute a into the destination
! * buffer b. Note that the size of b has to be at least equal to the value
! * returned by get_attribute_value_length(a).
* Return number of bytes copied. If this is zero check errno. If errno is 0
* then nothing was read due to a zero-length attribute value, otherwise
* errno describes the error.
*/
! __u64 get_attribute_value(ntfs_volume *vol, ATTRIBUTE_RECORD_HEADER *a, __u8 *b);
! /*
! * Set the value of the attribute a to the contents of the buffer b which has
! * a byte-size of l and write it to the NTFS volume vol.
* Return 1 on success and 0 on error, errno will be set in the latter case.
*
--- 781,896 ----
/* FIXME: Should this be a linked list so it is easier/quicker to edit? */
! /**
! * decompress_run_list - decompress a mapping pairs array into a run list
! * @attr: non-resident attribute whose mapping pairs array to decompress
! *
* Allocate a run_list array and decompress the run-list of the non-resident
! * attribute @attr into the run_list array.
! *
* Return a pointer to the run_list array or NULL on error.
* Notes: caller has to free the run_list array when finished.
*/
! run_list decompress_run_list(const NONRESIDENT_ATTRIBUTE_RECORD_HEADER *attr);
! /**
! * vcn_to_lcn - determine the lcn corresponding to a particular vcn
! * @rl: decompressed mapping pairs array (i.e. run list)
! * @vcn: virtucal cluster number to determine the lcn for
! *
! * Determine the logical cluster number given the virtual cluster number @vcn
! * and the run list @rl describing the mapping between the LCNs and VCNs.
* Return -ERRNO on error (ERRNO being the error number) and notably -NOENT
* if vcn is outside the boundaries covered by the run list.
*/
! __s64 vcn_to_lcn(const run_list rl, const __s64 vcn);
! /**
! * set_ntfs_volume_flags - set the flags of an ntfs volume
! * @b: pointer to a buffer containing the mft record of FILE_$Volume
! * @flags: new flags
! *
! * Set the volume flags in the mft record buffer @b to @flags.
* Return 1 on success or 0 on error.
*/
! int set_ntfs_volume_flags(MFT_RECORD_HEADER *b, const __u16 flags);
! /**
! * find_attribute - find an attribute in an mft record
! * @b: pointer to a buffer containing the mft record to search
! * @t: find attribute of this type
! * @n: find attribute of this name
! *
! * Get the location of the desired attribute of type @t and name @n (@n can be
! * NULL for unnamed attributes; note that @n is a Unicode string). Return a
* pointer to the attribute or NULL if the attribute is not present or an
* error situation exists.
! *
! * FIXME: There can be several attributes which have the same type and name.
! * Example: file name attribute. There will be several file name attributes
! * (e.g. one each for DOS and Win32 namespaces) which will both have the same
! * attribute type and the same attribute name (i.e. they are both unnamed) but
! * they will have different attribute values and in particular the file names
! * will be different.
! * So we need at least one more search key or a find_next_attribute() function
! * but that could get ugly as we need to save the context of the search (maybe
! * in user supplied "context buffer"? Or pass the result of find_attribute()
! * into find_next_attribute()?). The third search key could be the attribute
! * value itself or it could be dependent on the attribute type we are looking
! * for. For example for file name attributes it could be the name of the file.
! * FIXME: No it could not, as you can have the same file name appearing twice
! * if there are two hard links to the file with the same name but in different
! * directories. Ugh! Searching using attribute values is crazy as it would be
! * too slow or even impossible to generate the value to be used for in the
! * search. However we can do a find_next_attribute() function easily. In fact
! * we can also have a find_first_attribute/find_next_attribute combination in
! * general so we can enumerate all attributes in sequence. The context buffer
! * could be just the offset in the mft record of the next attribute or of the
! * last attribute that was returned by the function.
! */
! ATTRIBUTE_RECORD_HEADER *find_attribute(const MFT_RECORD_HEADER *b,
! const ATTRIBUTE_TYPE t,
! const wchar_t *n);
#include "volume.h"
! /**
! * get_attribute_value_length - return the length of the value of an attribute
! * @a: pointer to a buffer containing the attribute record
! *
! * Return the byte size of the attribute value of the attribute @a (as it
! * would be after eventual decompression and filling in of holes if sparse).
* If we return 0, check errno. If errno is 0 the actual length was 0,
* otherwise errno describes the error.
+ *
+ * FIXME: Describe possible errnos.
*/
! __u64 get_attribute_value_length(const ATTRIBUTE_RECORD_HEADER *a);
! /**
! * get_attribute_value - return the attribute value of an attribute
! * @vol: volume on which the attribute is present
! * @a: attribute to get the value of
! * @b: destination buffer for the attribute value
! *
! * Make a copy of the attribute value of the attribute @a into the destination
! * buffer @b. Note, that the size of @b has to be at least equal to the value
! * returned by get_attribute_value_length(@a).
! *
* Return number of bytes copied. If this is zero check errno. If errno is 0
* then nothing was read due to a zero-length attribute value, otherwise
* errno describes the error.
*/
! __u64 get_attribute_value(const ntfs_volume *vol,
! const ATTRIBUTE_RECORD_HEADER *a, __u8 *b);
! /**
! * set_attribute_value - set the attribute value of an attribute
! * @vol: volume on which the attribute is present
! * @a: attribute to set the value of
! * @b: buffer containing the new attribute value
! * @l: length in bytes of the new attribute value @b
! *
! * Set the value of the attribute @a to the contents of the buffer @b which has
! * a byte-size of @l and write it to the NTFS volume @vol.
* Return 1 on success and 0 on error, errno will be set in the latter case.
*
***************
*** 840,848 ****
* changes in the length of the resident part of the attribute which in turn
* means it doesn't cope with changes in length or on disk location of the
! * non-resident part of the attribute either! See ntfsfix.c for details.
*/
! int set_attribute_value(ntfs_volume *vol, ATTRIBUTE_RECORD_HEADER *a,
! unsigned char *b, __u64 l);
!
#endif /* defined ATTRIB_H */
--- 898,907 ----
* changes in the length of the resident part of the attribute which in turn
* means it doesn't cope with changes in length or on disk location of the
! * non-resident part of the attribute either! See ../ntfstools/ntfsfix.c for
! * details.
! * FIXME: Document possible errnos.
*/
! int set_attribute_value(ntfs_volume *vol, ATTRIBUTE_RECORD_HEADER *a,
! const __u8 *b, const __u64 l);
#endif /* defined ATTRIB_H */
|