# SOME DESCRIPTIVE TITLE # Copyright (C) YEAR Free Software Foundation, Inc. # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "POT-Creation-Date: 2024-06-01 05:57+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. type: TH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "ioctl_fat" msgstr "" #. type: TH #: archlinux debian-unstable opensuse-tumbleweed #, no-wrap msgid "2024-05-02" msgstr "" #. type: TH #: archlinux debian-unstable #, no-wrap msgid "Linux man-pages 6.8" msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "NAME" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "ioctl_fat - manipulating the FAT filesystem" msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "LIBRARY" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "Standard C library (I, I<-lc>)" msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "SYNOPSIS" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "" "B<#include Elinux/msdos_fs.hE> /* Definition of [B]B and\n" "B< ATTR_* >constantsB<*/\">\n" "B<#include Esys/ioctl.hE>\n" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "" "BIB<, FAT_IOCTL_GET_ATTRIBUTES, uint32_t *>IB<);>\n" "BIB<, FAT_IOCTL_SET_ATTRIBUTES, uint32_t *>IB<);>\n" "BIB<, FAT_IOCTL_GET_VOLUME_ID, uint32_t *>IB<);>\n" "BIB<, VFAT_IOCTL_READDIR_BOTH,>\n" "B< struct __fat_dirent >IB<[2]);>\n" "BIB<, VFAT_IOCTL_READDIR_SHORT,>\n" "B< struct __fat_dirent >IB<[2]);>\n" msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "DESCRIPTION" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The B(2) system call can be used to read and write metadata of FAT " "filesystems that are not accessible using other system calls." msgstr "" #. type: SS #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "Reading and setting file attributes" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Files and directories in the FAT filesystem possess an attribute bit mask " "that can be read with B and written with " "B." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The I argument contains a file descriptor for a file or directory. It " "is sufficient to create the file descriptor by calling B(2) with the " "B flag." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The I argument contains a pointer to a bit mask. The bits of the bit " "mask are:" msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "This bit specifies that the file or directory is read-only." msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "This bit specifies that the file or directory is hidden." msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "This bit specifies that the file is a system file." msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "This bit specifies that the file is a volume label. This attribute is read-" "only." msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "This bit specifies that this is a directory. This attribute is read-only." msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "This bit indicates that this file or directory should be archived. It is " "set when a file is created or modified. It is reset by an archiving system." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The zero value B can be used to indicate that no attribute bit is " "set." msgstr "" #. SRC END #. type: SS #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "Reading the volume ID" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "FAT filesystems are identified by a volume ID. The volume ID can be read " "with B." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The I argument can be a file descriptor for any file or directory of the " "filesystem. It is sufficient to create the file descriptor by calling " "B(2) with the B flag." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The I argument is a pointer to the field that will be filled with the " "volume ID. Typically the volume ID is displayed to the user as a group of " "two 16-bit fields:" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "printf(\"Volume ID %04x-%04x\\en\", id EE 16, id & 0xFFFF);\n" msgstr "" #. type: SS #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "Reading short filenames of a directory" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "A file or directory on a FAT filesystem always has a short filename " "consisting of up to 8 capital letters, optionally followed by a period and " "up to 3 capital letters for the file extension. If the actual filename does " "not fit into this scheme, it is stored as a long filename of up to 255 " "UTF-16 characters." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The short filenames in a directory can be read with " "B. B reads both the " "short and the long filenames." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The I argument must be a file descriptor for a directory. It is " "sufficient to create the file descriptor by calling B(2) with the " "B flag. The file descriptor can be used only once to iterate over " "the directory entries by calling B(2) repeatedly." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The I argument is a two-element array of the following structures:" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "" "struct __fat_dirent {\n" " long d_ino;\n" " __kernel_off_t d_off;\n" " uint32_t short d_reclen;\n" " char d_name[256];\n" "};\n" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The first entry in the array is for the short filename. The second entry is " "for the long filename." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The I and I fields are filled only for long filenames. The " "I field holds the inode number of the directory. The I field " "holds the offset of the file entry in the directory. As these values are " "not available for short filenames, the user code should simply ignore them." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The field I contains the length of the filename in the field " "I. To keep backward compatibility, a length of 0 for the short " "filename signals that the end of the directory has been reached. However, " "the preferred method for detecting the end of the directory is to test the " "B(2) return value. If no long filename exists, field I is " "set to 0 and I is a character string of length 0 for the long " "filename." msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "RETURN VALUE" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "On error, -1 is returned, and I is set to indicate the error." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "For B and B a return " "value of 1 signals that a new directory entry has been read and a return " "value of 0 signals that the end of the directory has been reached." msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "ERRORS" msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "This error is returned by B and " "B if the file descriptor I refers to a " "removed, but still open directory." msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "This error is returned by B and " "B if the file descriptor I does not refer to a " "directory." msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The file descriptor I does not refer to an object in a FAT filesystem." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "For further error values, see B(2)." msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "STANDARDS" msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed msgid "Linux." msgstr "" #. type: SH #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "HISTORY" msgstr "" #. type: TP #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "" #. type: TQ #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed msgid "Linux 2.0." msgstr "" #. type: TP #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "" #. type: TQ #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "" #. just before we got Git history #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed msgid "Linux 2.6.12." msgstr "" #. type: TP #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "" #. commit 6e5b93ee55d401f1619092fb675b57c28c9ed7ec #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed msgid "Linux 3.11." msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "EXAMPLES" msgstr "" #. type: SS #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "Toggling the archive flag" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The following program demonstrates the usage of B(2) to manipulate " "file attributes. The program reads and displays the archive attribute of a " "file. After inverting the value of the attribute, the program reads and " "displays the attribute again." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The following was recorded when applying the program for the file I:" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "" "# ./toggle_fat_archive_flag /mnt/user/foo\n" "Archive flag is set\n" "Toggling archive flag\n" "Archive flag is not set\n" msgstr "" #. type: SS #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "Program source (toggle_fat_archive_flag.c)" msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed #, no-wrap msgid "" "#include Efcntl.hE\n" "#include Elinux/msdos_fs.hE\n" "#include Estdint.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/ioctl.hE\n" "#include Eunistd.hE\n" "\\&\n" "/*\n" " * Read file attributes of a file on a FAT filesystem.\n" " * Output the state of the archive flag.\n" " */\n" "static uint32_t\n" "readattr(int fd)\n" "{\n" " int ret;\n" " uint32_t attr;\n" "\\&\n" " ret = ioctl(fd, FAT_IOCTL_GET_ATTRIBUTES, &attr);\n" " if (ret == -1) {\n" " perror(\"ioctl\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " if (attr & ATTR_ARCH)\n" " printf(\"Archive flag is set\\en\");\n" " else\n" " printf(\"Archive flag is not set\\en\");\n" "\\&\n" " return attr;\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " int fd;\n" " int ret;\n" " uint32_t attr;\n" "\\&\n" " if (argc != 2) {\n" " printf(\"Usage: %s FILENAME\\en\", argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " fd = open(argv[1], O_RDONLY);\n" " if (fd == -1) {\n" " perror(\"open\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /*\n" " * Read and display the FAT file attributes.\n" " */\n" " attr = readattr(fd);\n" "\\&\n" " /*\n" " * Invert archive attribute.\n" " */\n" " printf(\"Toggling archive flag\\en\");\n" " attr \\[ha]= ATTR_ARCH;\n" "\\&\n" " /*\n" " * Write the changed FAT file attributes.\n" " */\n" " ret = ioctl(fd, FAT_IOCTL_SET_ATTRIBUTES, &attr);\n" " if (ret == -1) {\n" " perror(\"ioctl\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /*\n" " * Read and display the FAT file attributes.\n" " */\n" " readattr(fd);\n" "\\&\n" " close(fd);\n" "\\&\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The following program demonstrates the use of B(2) to display the " "volume ID of a FAT filesystem." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The following output was recorded when applying the program for directory I:" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "" "$ ./display_fat_volume_id /mnt/user\n" "Volume ID 6443-6241\n" msgstr "" #. type: SS #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "Program source (display_fat_volume_id.c)" msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed #, no-wrap msgid "" "#include Efcntl.hE\n" "#include Elinux/msdos_fs.hE\n" "#include Estdint.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/ioctl.hE\n" "#include Eunistd.hE\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " int fd;\n" " int ret;\n" " uint32_t id;\n" "\\&\n" " if (argc != 2) {\n" " printf(\"Usage: %s FILENAME\\en\", argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " fd = open(argv[1], O_RDONLY);\n" " if (fd == -1) {\n" " perror(\"open\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /*\n" " * Read volume ID.\n" " */\n" " ret = ioctl(fd, FAT_IOCTL_GET_VOLUME_ID, &id);\n" " if (ret == -1) {\n" " perror(\"ioctl\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /*\n" " * Format the output as two groups of 16 bits each.\n" " */\n" " printf(\"Volume ID %04x-%04x\\en\", id EE 16, id & 0xFFFF);\n" "\\&\n" " close(fd);\n" "\\&\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" #. SRC END #. type: SS #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "Listing a directory" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The following program demonstrates the use of B(2) to list a " "directory." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The following was recorded when applying the program to the directory I:" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "" "$ B<./fat_dir /mnt/user>\n" "\\&. -E \\[aq]\\[aq]\n" "\\&.. -E \\[aq]\\[aq]\n" "ALONGF\\[ti]1.TXT -E \\[aq]a long filename.txt\\[aq]\n" "UPPER.TXT -E \\[aq]\\[aq]\n" "LOWER.TXT -E \\[aq]lower.txt\\[aq]\n" msgstr "" #. type: SS #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "Program source" msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed #, no-wrap msgid "" "#include Efcntl.hE\n" "#include Elinux/msdos_fs.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/ioctl.hE\n" "#include Eunistd.hE\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " int fd;\n" " int ret;\n" " struct __fat_dirent entry[2];\n" "\\&\n" " if (argc != 2) {\n" " printf(\"Usage: %s DIRECTORY\\en\", argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /*\n" " * Open file descriptor for the directory.\n" " */\n" " fd = open(argv[1], O_RDONLY | O_DIRECTORY);\n" " if (fd == -1) {\n" " perror(\"open\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " for (;;) {\n" "\\&\n" " /*\n" " * Read next directory entry.\n" " */\n" " ret = ioctl(fd, VFAT_IOCTL_READDIR_BOTH, entry);\n" "\\&\n" " /*\n" " * If an error occurs, the return value is -1.\n" " * If the end of the directory list has been reached,\n" " * the return value is 0.\n" " * For backward compatibility the end of the directory\n" " * list is also signaled by d_reclen == 0.\n" " */\n" " if (ret E 1)\n" " break;\n" "\\&\n" " /*\n" " * Write both the short name and the long name.\n" " */\n" " printf(\"%s -E \\[aq]%s\\[aq]\\en\", entry[0].d_name, entry[1].d_name);\n" " }\n" "\\&\n" " if (ret == -1) {\n" " perror(\"VFAT_IOCTL_READDIR_BOTH\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /*\n" " * Close the file descriptor.\n" " */\n" " close(fd);\n" "\\&\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "SEE ALSO" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "B(2)" msgstr "" #. type: TH #: debian-bookworm #, no-wrap msgid "2023-02-10" msgstr "" #. type: TH #: debian-bookworm #, no-wrap msgid "Linux man-pages 6.03" msgstr "" #. type: SH #: debian-bookworm #, no-wrap msgid "VERSIONS" msgstr "" #. type: Plain text #: debian-bookworm msgid "" "B and B first appeared in " "Linux 2.0." msgstr "" #. just before we got Git history #. type: Plain text #: debian-bookworm msgid "" "B and B first appeared " "in Linux 2.6.12." msgstr "" #. commit 6e5b93ee55d401f1619092fb675b57c28c9ed7ec #. type: Plain text #: debian-bookworm msgid "" "B was introduced in version 3.11 of the Linux " "kernel." msgstr "" #. type: Plain text #: debian-bookworm msgid "This API is Linux-specific." msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" "#include Efcntl.hE\n" "#include Elinux/msdos_fs.hE\n" "#include Estdint.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/ioctl.hE\n" "#include Eunistd.hE\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" "/*\n" " * Read file attributes of a file on a FAT filesystem.\n" " * Output the state of the archive flag.\n" " */\n" "static uint32_t\n" "readattr(int fd)\n" "{\n" " int ret;\n" " uint32_t attr;\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " ret = ioctl(fd, FAT_IOCTL_GET_ATTRIBUTES, &attr);\n" " if (ret == -1) {\n" " perror(\"ioctl\");\n" " exit(EXIT_FAILURE);\n" " }\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " if (attr & ATTR_ARCH)\n" " printf(\"Archive flag is set\\en\");\n" " else\n" " printf(\"Archive flag is not set\\en\");\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " return attr;\n" "}\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" "int\n" "main(int argc, char *argv[])\n" "{\n" " int fd;\n" " int ret;\n" " uint32_t attr;\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " if (argc != 2) {\n" " printf(\"Usage: %s FILENAME\\en\", argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " fd = open(argv[1], O_RDONLY);\n" " if (fd == -1) {\n" " perror(\"open\");\n" " exit(EXIT_FAILURE);\n" " }\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " /*\n" " * Read and display the FAT file attributes.\n" " */\n" " attr = readattr(fd);\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " /*\n" " * Invert archive attribute.\n" " */\n" " printf(\"Toggling archive flag\\en\");\n" " attr \\[ha]= ATTR_ARCH;\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " /*\n" " * Write the changed FAT file attributes.\n" " */\n" " ret = ioctl(fd, FAT_IOCTL_SET_ATTRIBUTES, &attr);\n" " if (ret == -1) {\n" " perror(\"ioctl\");\n" " exit(EXIT_FAILURE);\n" " }\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " /*\n" " * Read and display the FAT file attributes.\n" " */\n" " readattr(fd);\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " close(fd);\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" "int\n" "main(int argc, char *argv[])\n" "{\n" " int fd;\n" " int ret;\n" " uint32_t id;\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " /*\n" " * Read volume ID.\n" " */\n" " ret = ioctl(fd, FAT_IOCTL_GET_VOLUME_ID, &id);\n" " if (ret == -1) {\n" " perror(\"ioctl\");\n" " exit(EXIT_FAILURE);\n" " }\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " /*\n" " * Format the output as two groups of 16 bits each.\n" " */\n" " printf(\"Volume ID %04x-%04x\\en\", id EE 16, id & 0xFFFF);\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" "#include Efcntl.hE\n" "#include Elinux/msdos_fs.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/ioctl.hE\n" "#include Eunistd.hE\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" "int\n" "main(int argc, char *argv[])\n" "{\n" " int fd;\n" " int ret;\n" " struct __fat_dirent entry[2];\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " if (argc != 2) {\n" " printf(\"Usage: %s DIRECTORY\\en\", argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " /*\n" " * Open file descriptor for the directory.\n" " */\n" " fd = open(argv[1], O_RDONLY | O_DIRECTORY);\n" " if (fd == -1) {\n" " perror(\"open\");\n" " exit(EXIT_FAILURE);\n" " }\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " for (;;) {\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " /*\n" " * Read next directory entry.\n" " */\n" " ret = ioctl(fd, VFAT_IOCTL_READDIR_BOTH, entry);\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " /*\n" " * If an error occurs, the return value is -1.\n" " * If the end of the directory list has been reached,\n" " * the return value is 0.\n" " * For backward compatibility the end of the directory\n" " * list is also signaled by d_reclen == 0.\n" " */\n" " if (ret E 1)\n" " break;\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " /*\n" " * Write both the short name and the long name.\n" " */\n" " printf(\"%s -E \\[aq]%s\\[aq]\\en\", entry[0].d_name, entry[1].d_name);\n" " }\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " if (ret == -1) {\n" " perror(\"VFAT_IOCTL_READDIR_BOTH\");\n" " exit(EXIT_FAILURE);\n" " }\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " /*\n" " * Close the file descriptor.\n" " */\n" " close(fd);\n" msgstr "" #. type: TH #: fedora-40 fedora-rawhide mageia-cauldron #, no-wrap msgid "2023-10-31" msgstr "" #. type: TH #: fedora-40 mageia-cauldron #, no-wrap msgid "Linux man-pages 6.06" msgstr "" #. type: TH #: fedora-rawhide #, no-wrap msgid "Linux man-pages 6.7" msgstr "" #. type: TH #: opensuse-leap-15-6 #, no-wrap msgid "2023-03-30" msgstr "" #. type: TH #: opensuse-leap-15-6 #, no-wrap msgid "Linux man-pages 6.04" msgstr "" #. type: TH #: opensuse-tumbleweed #, no-wrap msgid "Linux man-pages (unreleased)" msgstr ""