Changeset ed19497 in mainline


Ignore:
Timestamp:
2011-06-05T14:26:58Z (13 years ago)
Author:
Oleg Romanenko <romanenko.oleg@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
34fdb75
Parents:
2df7fdd4
Message:

Function for compute cheksum for Node name

Location:
uspace/srv/fs/fat
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/fat/fat_dentry.c

    r2df7fdd4 red19497  
    240240}
    241241
     242/** Compute checksum of Node name.
     243 *
     244 * Returns an unsigned byte checksum computed on an unsigned byte
     245 * array. The array must be 11 bytes long and is assumed to contain
     246 * a name stored in the format of a MS-DOS directory entry.
     247 *
     248 * @param name          Node name read from the dentry.
     249 *
     250 * @return              An 8-bit unsigned checksum of the name.
     251 */
     252uint8_t fat_dentry_chksum(uint8_t *name)
     253{
     254        uint8_t i, sum=0;
     255        for (i=0; i<(FAT_NAME_LEN+FAT_EXT_LEN); i++) {
     256                sum = ((sum & 1) ? 0x80 : 0) + (sum >> 1) + name[i];
     257        }
     258        return sum;
     259}
     260
     261
    242262/**
    243263 * @}
  • uspace/srv/fs/fat/fat_dentry.h

    r2df7fdd4 red19497  
    112112extern void fat_dentry_name_set(fat_dentry_t *, const char *);
    113113extern fat_dentry_clsf_t fat_classify_dentry(const fat_dentry_t *);
     114extern uint8_t fat_dentry_chksum(uint8_t *);
    114115
    115116#endif
Note: See TracChangeset for help on using the changeset viewer.