fs/orangefs/protocol.h

Source file repositories/reference/linux-study-clean/fs/orangefs/protocol.h

File Facts

System
Linux kernel
Corpus path
fs/orangefs/protocol.h
Extension
.h
Size
11505 bytes
Lines
363
Domain
Core OS
Bucket
VFS And Filesystem Core
Inferred role
Core OS: implementation source
Status
source implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

struct orangefs_khandle {
	unsigned char u[16];
}  __aligned(8);

/*
 * kernel version of an object ref.
 */
struct orangefs_object_kref {
	struct orangefs_khandle khandle;
	__s32 fs_id;
	__s32 __pad1;
};

/*
 * compare 2 khandles assumes little endian thus from large address to
 * small address
 */
static inline int ORANGEFS_khandle_cmp(const struct orangefs_khandle *kh1,
				   const struct orangefs_khandle *kh2)
{
	int i;

	for (i = 15; i >= 0; i--) {
		if (kh1->u[i] > kh2->u[i])
			return 1;
		if (kh1->u[i] < kh2->u[i])
			return -1;
	}

	return 0;
}

static inline void ORANGEFS_khandle_to(const struct orangefs_khandle *kh,
				   void *p, int size)
{

	memcpy(p, kh->u, 16);
	memset(p + 16, 0, size - 16);

}

static inline void ORANGEFS_khandle_from(struct orangefs_khandle *kh,
				     void *p, int size)
{
	memset(kh, 0, 16);
	memcpy(kh->u, p, 16);

}

/* pvfs2-types.h ************************************************************/

#define ORANGEFS_SUPER_MAGIC 0x20030528

/*
 * ORANGEFS error codes are a signed 32-bit integer. Error codes are negative, but
 * the sign is stripped before decoding.
 */

/* Bit 31 is not used since it is the sign. */

/*
 * Bit 30 specifies that this is a ORANGEFS error. A ORANGEFS error is either an
 * encoded errno value or a ORANGEFS protocol error.
 */
#define ORANGEFS_ERROR_BIT (1 << 30)

/*
 * Bit 29 specifies that this is a ORANGEFS protocol error and not an encoded
 * errno value.
 */
#define ORANGEFS_NON_ERRNO_ERROR_BIT (1 << 29)

/*
 * Bits 9, 8, and 7 specify the error class, which encodes the section of
 * server code the error originated in for logging purposes. It is not used
 * in the kernel except to be masked out.
 */
#define ORANGEFS_ERROR_CLASS_BITS 0x380

/* Bits 6 - 0 are reserved for the actual error code. */
#define ORANGEFS_ERROR_NUMBER_BITS 0x7f

/* Encoded errno values decoded by PINT_errno_mapping in orangefs-utils.c. */

/* Our own ORANGEFS protocol error codes. */
#define ORANGEFS_ECANCEL    (1|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
#define ORANGEFS_EDEVINIT   (2|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
#define ORANGEFS_EDETAIL    (3|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
#define ORANGEFS_EHOSTNTFD  (4|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)
#define ORANGEFS_EADDRNTFD  (5|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT)

Annotation

Implementation Notes