blob: cf09e0b081da2038dad0e8fb4387a62b455082a2 [file] [log] [blame]
Ambroise Vincent81042e32019-07-11 14:49:47 +01001/*
2 * Copyright (c) 2019, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef DEBUGFS_H
8#define DEBUGFS_H
9
10#define NAMELEN 13 /* Maximum length of a file name */
11#define PATHLEN 41 /* Maximum length of a path */
12#define STATLEN 41 /* Size of static part of dir format */
13#define ROOTLEN (2 + 4) /* Size needed to encode root string */
14#define FILNAMLEN (2 + NAMELEN) /* Size needed to encode filename */
15#define DIRLEN (STATLEN + FILNAMLEN + 3*ROOTLEN) /* Size of dir entry */
16
17#define KSEEK_SET 0
18#define KSEEK_CUR 1
19#define KSEEK_END 2
20
21#define NELEM(tab) (sizeof(tab) / sizeof((tab)[0]))
22
23typedef unsigned short qid_t;
24
25/*******************************************************************************
26 * This structure contains the necessary information to represent a 9p
27 * directory.
28 ******************************************************************************/
29typedef struct {
30 char name[NAMELEN];
31 long length;
32 unsigned char mode;
33 unsigned char type;
34 unsigned char dev;
35 qid_t qid;
36} dir_t;
37
38enum devflags {
39 O_READ = 1 << 0,
40 O_WRITE = 1 << 1,
41 O_RDWR = 1 << 2,
42 O_BIND = 1 << 3,
43 O_DIR = 1 << 4,
44 O_STAT = 1 << 5
45};
46
47#define MOUNT 0
48#define CREATE 1
49#define OPEN 2
50#define CLOSE 3
51#define READ 4
52#define WRITE 5
53#define SEEK 6
54#define BIND 7
55#define STAT 8
56#define INIT 10
57#define VERSION 11
58
59#endif /* DEBUGFS_H */