Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
b498da87
Commit
b498da87
authored
18 years ago
by
jonas@perch.ndb.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ndb -
handle open(O_DIRECT) -> EINVAL remove need for NDB_NO_ODIRECT
parent
d935ab72
Branches unavailable
Tags unavailable
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
19 deletions
+42
-19
storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
+42
-19
No files found.
storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
View file @
b498da87
...
@@ -312,11 +312,12 @@ void AsyncFile::openReq(Request* request)
...
@@ -312,11 +312,12 @@ void AsyncFile::openReq(Request* request)
Uint32
new_flags
=
0
;
Uint32
new_flags
=
0
;
// Convert file open flags from Solaris to Liux
// Convert file open flags from Solaris to Liux
if
(
flags
&
FsOpenReq
::
OM_CREATE
){
if
(
flags
&
FsOpenReq
::
OM_CREATE
)
{
new_flags
|=
O_CREAT
;
new_flags
|=
O_CREAT
;
}
}
if
(
flags
&
FsOpenReq
::
OM_TRUNCATE
){
if
(
flags
&
FsOpenReq
::
OM_TRUNCATE
){
#if 0
#if 0
if(Global_unlinkO_CREAT){
if(Global_unlinkO_CREAT){
unlink(theFileName.c_str());
unlink(theFileName.c_str());
...
@@ -330,25 +331,25 @@ void AsyncFile::openReq(Request* request)
...
@@ -330,25 +331,25 @@ void AsyncFile::openReq(Request* request)
m_syncFrequency
=
1024
*
1024
;
// Hard coded to 1M
m_syncFrequency
=
1024
*
1024
;
// Hard coded to 1M
}
}
if
(
flags
&
FsOpenReq
::
OM_APPEND
){
if
(
flags
&
FsOpenReq
::
OM_APPEND
){
new_flags
|=
O_APPEND
;
new_flags
|=
O_APPEND
;
}
}
if
((
flags
&
FsOpenReq
::
OM_SYNC
)
&&
!
(
flags
&
FsOpenReq
::
OM_INIT
))
if
((
flags
&
FsOpenReq
::
OM_SYNC
)
&&
!
(
flags
&
FsOpenReq
::
OM_INIT
))
{
{
#ifdef O_SYNC
#ifdef O_SYNC
new_flags
|=
O_SYNC
;
new_flags
|=
O_SYNC
;
#endif
#endif
}
}
#ifndef NDB_NO_O_DIRECT
/* to allow tmpfs */
//
#ifndef NDB_NO_O_DIRECT /* to allow tmpfs */
#ifdef O_DIRECT
#ifdef O_DIRECT
if
(
flags
&
FsOpenReq
::
OM_DIRECT
)
if
(
flags
&
FsOpenReq
::
OM_DIRECT
)
{
{
new_flags
|=
O_DIRECT
;
new_flags
|=
O_DIRECT
;
}
}
#endif
#endif
#endif
//
#endif
switch
(
flags
&
0x3
){
switch
(
flags
&
0x3
){
case
FsOpenReq
:
:
OM_READONLY
:
case
FsOpenReq
:
:
OM_READONLY
:
...
@@ -370,8 +371,14 @@ void AsyncFile::openReq(Request* request)
...
@@ -370,8 +371,14 @@ void AsyncFile::openReq(Request* request)
const
int
mode
=
S_IRUSR
|
S_IWUSR
|
const
int
mode
=
S_IRUSR
|
S_IWUSR
|
S_IRGRP
|
S_IWGRP
|
S_IRGRP
|
S_IWGRP
|
S_IROTH
|
S_IWOTH
;
S_IROTH
|
S_IWOTH
;
if
(
flags
&
FsOpenReq
::
OM_CREATE_IF_NONE
){
if
(
flags
&
FsOpenReq
::
OM_CREATE_IF_NONE
)
if
((
theFd
=
::
open
(
theFileName
.
c_str
(),
new_flags
,
mode
))
!=
-
1
)
{
{
Uint32
tmp_flags
=
new_flags
;
#ifdef O_DIRECT
tmp_flags
&=
~
O_DIRECT
;
#endif
if
((
theFd
=
::
open
(
theFileName
.
c_str
(),
tmp_flags
,
mode
))
!=
-
1
)
{
close
(
theFd
);
close
(
theFd
);
request
->
error
=
FsRef
::
fsErrFileExists
;
request
->
error
=
FsRef
::
fsErrFileExists
;
return
;
return
;
...
@@ -379,35 +386,51 @@ void AsyncFile::openReq(Request* request)
...
@@ -379,35 +386,51 @@ void AsyncFile::openReq(Request* request)
new_flags
|=
O_CREAT
;
new_flags
|=
O_CREAT
;
}
}
if
(
-
1
==
(
theFd
=
::
open
(
theFileName
.
c_str
(),
new_flags
,
mode
)))
{
no_odirect:
if
(
-
1
==
(
theFd
=
::
open
(
theFileName
.
c_str
(),
new_flags
,
mode
)))
{
PRINT_ERRORANDFLAGS
(
new_flags
);
PRINT_ERRORANDFLAGS
(
new_flags
);
if
(
(
errno
==
ENOENT
)
&&
(
new_flags
&
O_CREAT
)
)
{
if
((
errno
==
ENOENT
)
&&
(
new_flags
&
O_CREAT
))
{
createDirectories
();
createDirectories
();
if
(
-
1
==
(
theFd
=
::
open
(
theFileName
.
c_str
(),
new_flags
,
mode
)))
{
if
(
-
1
==
(
theFd
=
::
open
(
theFileName
.
c_str
(),
new_flags
,
mode
)))
{
PRINT_ERRORANDFLAGS
(
new_flags
);
PRINT_ERRORANDFLAGS
(
new_flags
);
request
->
error
=
errno
;
request
->
error
=
errno
;
return
;
return
;
}
}
}
else
{
}
#ifdef O_DIRECT
else
if
(
new_flags
&
O_DIRECT
)
{
new_flags
&=
~
O_DIRECT
;
goto
no_odirect
;
}
#endif
else
{
request
->
error
=
errno
;
request
->
error
=
errno
;
return
;
return
;
}
}
}
}
if
(
flags
&
FsOpenReq
::
OM_CHECK_SIZE
)
if
(
flags
&
FsOpenReq
::
OM_CHECK_SIZE
)
{
{
struct
stat
buf
;
struct
stat
buf
;
if
((
fstat
(
theFd
,
&
buf
)
==
-
1
))
if
((
fstat
(
theFd
,
&
buf
)
==
-
1
))
{
{
request
->
error
=
errno
;
request
->
error
=
errno
;
}
else
if
(
buf
.
st_size
!=
request
->
par
.
open
.
file_size
){
}
else
if
(
buf
.
st_size
!=
request
->
par
.
open
.
file_size
)
{
request
->
error
=
FsRef
::
fsErrInvalidFileSize
;
request
->
error
=
FsRef
::
fsErrInvalidFileSize
;
}
}
if
(
request
->
error
)
if
(
request
->
error
)
return
;
return
;
}
}
if
(
flags
&
FsOpenReq
::
OM_INIT
){
if
(
flags
&
FsOpenReq
::
OM_INIT
)
{
off_t
off
=
0
;
off_t
off
=
0
;
const
off_t
sz
=
request
->
par
.
open
.
file_size
;
const
off_t
sz
=
request
->
par
.
open
.
file_size
;
Uint32
tmp
[
sizeof
(
SignalHeader
)
+
25
];
Uint32
tmp
[
sizeof
(
SignalHeader
)
+
25
];
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment