ReactOS 0.4.15-dev-5667-ged97270
pnfs_debug.c
Go to the documentation of this file.
1/* NFSv4.1 client for Windows
2 * Copyright 2012 The Regents of the University of Michigan
3 *
4 * Olga Kornievskaia <aglo@umich.edu>
5 * Casey Bodley <cbodley@umich.edu>
6 *
7 * This library is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation; either version 2.1 of the License, or (at
10 * your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful, but
13 * without any warranty; without even the implied warranty of merchantability
14 * or fitness for a particular purpose. See the GNU Lesser General Public
15 * License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this library; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 */
21
22#include <winsock2.h>
23#include <strsafe.h>
24#include "pnfs.h"
25#include "daemon_debug.h"
26
27
29{
30 switch (status) {
31 case PNFS_SUCCESS: return "PNFS_SUCCESS";
32 case PNFS_PENDING: return "PNFS_PENDING";
33 case PNFS_READ_EOF: return "PNFS_READ_EOF";
34 case PNFSERR_NOT_SUPPORTED: return "PNFSERR_NOT_SUPPORTED";
35 case PNFSERR_NOT_CONNECTED: return "PNFSERR_NOT_CONNECTED";
36 case PNFSERR_IO: return "PNFSERR_IO";
37 case PNFSERR_NO_DEVICE: return "PNFSERR_NO_DEVICE";
38 case PNFSERR_NO_LAYOUT: return "PNFSERR_NO_LAYOUT";
39 case PNFSERR_INVALID_FH_LIST: return "PNFSERR_INVALID_FH_LIST";
40 case PNFSERR_INVALID_DS_INDEX: return "PNFSERR_INVALID_DS_INDEX";
41 case PNFSERR_RESOURCES: return "PNFSERR_RESOURCES";
42 case PNFSERR_LAYOUT_RECALLED: return "PNFSERR_LAYOUT_RECALLED";
43 case PNFSERR_LAYOUT_CHANGED: return "PNFSERR_LAYOUT_CHANGED";
44 default: return "Invalid pnfs status";
45 }
46}
47
49{
50 switch (type) {
51 case PNFS_LAYOUTTYPE_FILE: return "PNFS_LAYOUTTYPE_FILE";
52 case PNFS_LAYOUTTYPE_OBJECT: return "PNFS_LAYOUTTYPE_OBJECT";
53 case PNFS_LAYOUTTYPE_BLOCK: return "PNFS_LAYOUTTYPE_BLOCK";
54 default: return "Invalid layout type";
55 }
56}
57
58const char* pnfs_iomode_string(enum pnfs_iomode iomode)
59{
60 switch (iomode) {
61 case PNFS_IOMODE_READ: return "PNFS_IOMODE_READ";
62 case PNFS_IOMODE_RW: return "PNFS_IOMODE_RW";
63 case PNFS_IOMODE_ANY: return "PNFS_IOMODE_ANY";
64 default: return "Invalid io mode";
65 }
66}
67
69 IN int level,
70 IN const char *title,
71 IN const unsigned char *deviceid)
72{
73 /* deviceid is 16 bytes, so print it as 4 uints */
74 uint32_t *p = (uint32_t*)deviceid;
75 dprintf(level, "%s%08X.%08X.%08X.%08X\n",
76 title, htonl(p[0]), htonl(p[1]), htonl(p[2]), htonl(p[3]));
77}
78
80 IN int level,
82{
83 dprintf(level, " type: %s\n", pnfs_layout_type_string(layout->layout.type));
84 dprintf(level, " iomode: %s\n", pnfs_iomode_string(layout->layout.iomode));
85 dprint_deviceid(level, " deviceid: ", layout->deviceid);
86 dprintf(level, " offset: %llu\n", layout->layout.offset);
87 dprintf(level, " length: %llu\n", layout->layout.length);
88 dprintf(level, " pattern_offset: %llu\n", layout->pattern_offset);
89 dprintf(level, " first_index: %u\n", layout->first_index);
90 dprintf(level, " dense: %u\n", is_dense(layout));
91 dprintf(level, " commit_to_mds: %u\n", should_commit_to_mds(layout));
92 dprintf(level, " stripe_unit_size: %u\n", layout_unit_size(layout));
93 dprintf(level, " file handles: %u\n", layout->filehandles.count);
94}
95
96#define MULTI_ADDR_BUFFER_LEN \
97 (NFS41_ADDRS_PER_SERVER*(NFS41_UNIVERSAL_ADDR_LEN+1)+1)
98
100 IN int level,
102 IN const multi_addr4 *addrs)
103{
104 char buffer[MULTI_ADDR_BUFFER_LEN] = "";
105 uint32_t i;
106 for (i = 0; i < addrs->count; i++) {
107 StringCchCatA(buffer, MULTI_ADDR_BUFFER_LEN, addrs->arr[i].uaddr);
109 }
110 dprintf(level, " servers[%d]: [ %s]\n", index, buffer);
111}
112
114 IN int level,
116{
117 uint32_t i;
118 dprint_deviceid(level, " deviceid: ", device->device.deviceid);
119 dprintf(level, " type: %s\n", pnfs_layout_type_string(device->device.type));
120 dprintf(level, " stripes: %u\n", device->stripes.count);
121 for (i = 0; i < device->servers.count; i++)
122 dprint_multi_addr(level, i, &device->servers.arr[i].addrs);
123}
UINT32 uint32_t
Definition: types.h:75
GLint level
Definition: gl.h:1546
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint buffer
Definition: glext.h:5915
GLuint index
Definition: glext.h:6031
GLfloat GLfloat p
Definition: glext.h:8902
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define htonl(x)
Definition: module.h:212
static DWORD layout
Definition: bitmap.c:46
__inline uint32_t layout_unit_size(IN const pnfs_file_layout *layout)
Definition: pnfs.h:315
__inline int is_dense(IN const pnfs_file_layout *layout)
Definition: pnfs.h:297
pnfs_status
Definition: pnfs.h:58
@ PNFSERR_NOT_SUPPORTED
Definition: pnfs.h:62
@ PNFSERR_IO
Definition: pnfs.h:64
@ PNFS_PENDING
Definition: pnfs.h:60
@ PNFSERR_NOT_CONNECTED
Definition: pnfs.h:63
@ PNFSERR_LAYOUT_CHANGED
Definition: pnfs.h:71
@ PNFSERR_NO_LAYOUT
Definition: pnfs.h:66
@ PNFSERR_INVALID_FH_LIST
Definition: pnfs.h:67
@ PNFSERR_RESOURCES
Definition: pnfs.h:69
@ PNFS_READ_EOF
Definition: pnfs.h:61
@ PNFSERR_NO_DEVICE
Definition: pnfs.h:65
@ PNFSERR_INVALID_DS_INDEX
Definition: pnfs.h:68
@ PNFSERR_LAYOUT_RECALLED
Definition: pnfs.h:70
@ PNFS_SUCCESS
Definition: pnfs.h:59
__inline int should_commit_to_mds(IN const pnfs_file_layout *layout)
Definition: pnfs.h:306
pnfs_iomode
Definition: pnfs.h:80
@ PNFS_IOMODE_ANY
Definition: pnfs.h:83
@ PNFS_IOMODE_READ
Definition: pnfs.h:81
@ PNFS_IOMODE_RW
Definition: pnfs.h:82
pnfs_layout_type
Definition: pnfs.h:74
@ PNFS_LAYOUTTYPE_OBJECT
Definition: pnfs.h:76
@ PNFS_LAYOUTTYPE_FILE
Definition: pnfs.h:75
@ PNFS_LAYOUTTYPE_BLOCK
Definition: pnfs.h:77
void dprint_layout(IN int level, IN const pnfs_file_layout *layout)
Definition: pnfs_debug.c:79
static void dprint_multi_addr(IN int level, IN uint32_t index, IN const multi_addr4 *addrs)
Definition: pnfs_debug.c:99
void dprint_deviceid(IN int level, IN const char *title, IN const unsigned char *deviceid)
Definition: pnfs_debug.c:68
#define MULTI_ADDR_BUFFER_LEN
Definition: pnfs_debug.c:96
const char * pnfs_iomode_string(enum pnfs_iomode iomode)
Definition: pnfs_debug.c:58
const char * pnfs_layout_type_string(enum pnfs_layout_type type)
Definition: pnfs_debug.c:48
const char * pnfs_error_string(enum pnfs_status status)
Definition: pnfs_debug.c:28
void dprint_device(IN int level, IN const pnfs_file_device *device)
Definition: pnfs_debug.c:113
static char title[]
Definition: ps.c:92
#define dprintf
Definition: regdump.c:33
STRSAFEAPI StringCchCatA(STRSAFE_LPSTR pszDest, size_t cchDest, STRSAFE_LPCSTR pszSrc)
Definition: strsafe.h:320
Definition: devices.h:37
Definition: ps.c:97
#define IN
Definition: typedefs.h:39