Get the flags for a file
#include <sys/dcmd_blk.h> #define DCMD_FSYS_FILE_FLAGS __DIOTF(_DCMD_FSYS, 20, struct fs_fileflags)
| Argument | Value |
|---|---|
| filedes | A file descriptor that you obtained by opening the device. |
| dcmd | DCMD_FSYS_FILE_FLAGS |
| dev_data_ptr | A pointer to a struct fs_fileflags (see below) |
| n_bytes | sizeof(struct fs_fileflags) |
| dev_info_ptr | NULL |
This command gets flags that indicate file attributes. The chattr utility is a front end for this command; for information about the flags, see its entry in the Utilities Reference.
None.
The fs_fileflags structure is defined as follows:
struct fs_fileflags {
uint16_t mask[2];
uint16_t bits[2];
char basetype[16];
};
The members include:
struct fs_fileflags ff;
memset(&ff, 0, sizeof ff);
if((err = devctl(fd, DCMD_FSYS_FILE_FLAGS, &ff, sizeof ff, 0)) != EOK) {
printf("fsys_file_flags=%s(%d)\n", strerror(err), err);
} else {
printf("fsys_file_flags=%#x:%#x\n", ff.bits[0], ff.bits[1]);
}