xref: /haiku/src/add-ons/kernel/file_systems/exfat/Utility.h (revision ed24eb5ff12640d052171c6a7feba37fab8a75d1)
1 /*
2  * Copyright 2001-2009, Axel Dörfler, axeld@pinc-software.de.
3  * Copyright 2014 Haiku, Inc. All rights reserved.
4  *
5  * Distributed under the terms of the MIT License.
6  *
7  * Authors:
8  *		Axel Dörfler, axeld@pinc-software.de
9  *		John Scipione, jscipione@gmail.com
10  */
11 #ifndef UTILITY_H
12 #define UTILITY_H
13 
14 
15 #include "exfat.h"
16 
17 
18 enum inode_type {
19 	S_DIRECTORY		= S_IFDIR,
20 	S_FILE			= S_IFREG,
21 	S_SYMLINK		= S_IFLNK,
22 
23 	S_INDEX_TYPES	= (S_STR_INDEX | S_INT_INDEX | S_UINT_INDEX
24 						| S_LONG_LONG_INDEX | S_ULONG_LONG_INDEX
25 						| S_FLOAT_INDEX | S_DOUBLE_INDEX),
26 
27 	S_EXTENDED_TYPES = (S_ATTR_DIR | S_ATTR | S_INDEX_DIR)
28 };
29 
30 
31 /*!	Reads the volume name from an exfat entry and writes it to
32 	\a name as a UTF-8 char array.
33 
34 	Writes a blank string to \a name if the volume name is not set.
35 
36 	\param entry The \a entry to look for the volume name in.
37 	\param name The \a name array to fill out.
38 	\param length The \a length of the name array in bytes.
39 
40 	\returns A status code, \c B_OK on success or an error code otherwise.
41 	\retval B_OK Wrote the volume name to \a name successfully.
42 	\retval B_BAD_VALUE \a entry or \a name was \c NULL.
43 	\retval B_NAME_NOT_FOUND Volume name was not found in this \a entry.
44 	\retval B_NAME_TOO_LONG \a name wasn't long enough to fit the volume name.
45 */
46 status_t get_volume_name(struct exfat_entry* entry, char* name, size_t length);
47 
48 
49 /*!	Writes a more or less descriptive volume name to \a name.
50 
51 	\param partitionSize The partion size in bytes.
52 	\param name The \a name array to fill out.
53 	\param length The \a length of the name array in bytes.
54 */
55 void get_default_volume_name(off_t partitionSize, char* name, size_t length);
56 
57 
58 #endif	// UTILITY_H
59